<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
	<script type="text/javascript" src="../../../Scripts/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/QueryString2016.js"></script>
    <link href="../../../../DataUser/Style/table0.css" rel="stylesheet" />
    <script src="../../../Scripts/config.js" type="text/javascript"></script>
    
    <script language="javascript" type="text/javascript" >
        /* ESC Key Down */
        var pageData = {};
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }
        //页面启动函数.
        $(function () {

            $("#Msg").html("正在加载,请稍后......");
		
            InitPage();

            $("#Msg").html("");

        });

        function InitPage() {
            var no = unescape(GetQueryString("No"));
            if (no != undefined && no != '') {
                pageData.DoType = "Edit";
                $.ajax({
                    type: 'post',
                    async: true,
                    url: basePath+"/WF/Admin/FoolFormDesigner/Rpt.do?DoType=S0_OneRpt_Init&No=" + no +  "&m=" + Math.random(),
                    dataType: 'html',
                    success: function (data) {
                        if (data.indexOf("@")==0) {
                            alert(data);
                            return;
                        }
                        data = JSON.parse(data);
                            $('#TxbNo').val(no);
                            $('#TxbName').val(data.name);
                            $('#TxbNote').val(data.note);
                    }
                });
            } 
            else {
                pageData.DoType = "Add";
            }
        }

        function Save() {
            var fk_flow = GetQueryString("FK_Flow");
            var no = $('#TxbNo').val();
            var name = $('#TxbName').val();
            var note = $('#TxbNote').val();
            if (pageData.DoType == "Add") {
                $.ajax({
                    type: 'post',
                    async: true,
                    url: basePath+"/WF/Admin/FoolFormDesigner/Rpt.do?DoType=S0_RptList_New&No=" + no + "&Name=" + name + "&Note=" + note + "&FK_Flow=" + fk_flow + "&m=" + Math.random(),
                    dataType: 'html',
                    success: function (data) {
                        alert(data)
                        if (window.opener != null) {
                            //刷新父窗口
                            window.opener.location.reload();
                        }
                        window.close();
                    }
                });
            } else {
                $.ajax({
                    type: 'post',
                    async: true,
                    data: { "No": no, "Name": name, "Note": note },
                    url: basePath+"/WF/Admin/FoolFormDesigner/Rpt.do?DoType=S0_RptList_Edit" + "&FK_Flow=" + fk_flow + "&m=" + Math.random(),
                    dataType: 'html',
                    success: function (data) {
                        alert(data)
                        if (window.opener != null) {
                            //刷新父窗口
                            window.opener.location.reload();
                        }
                        window.close();
                    }
                });
            }
        }

        function Cancel() {
            window.close();
        }
    </script>
     <base target="_self" /> 
    <link href="../../../Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
</head>
<body onkeypress="Esc()" >

<form name='cc' id='cc'>
  <table class='Table' cellpadding='0' cellspacing='0' style='width: 100%;'>
        <tr>
            <td class="GroupTitle">
                编号:
            </td>
            <td>
                <input type="text" id="TxbNo"/>默认报表编号为:ND**MyRpt ,建议报表编号向后推：如ND20MyRpt1，ND20MyRpt2
            </td>
        </tr>
        <tr>
            <td class="GroupTitle">
                名称:
            </td>
            <td>
                <input type="text" id="TxbName"/>
            </td>
        </tr>
        <tr>
            <td class="GroupTitle">
                备注:
            </td>
            <td>
                <input type="text" id="TxbNote"/>
            </td>
        </tr>
    </table>
    <br />

    <input type="button" id="Btn_Save" name="Btn_Save" value="保存" onclick="Save()" />
    <!--<input type="button" id="Button1" name="Btn_Save" value="保存并设置显示列" onclick="SaveAndNext()" />-->
    <input type="button" id="Button2" name="Btn_Save" value="取消" onclick="Cancel()" />

</form>

</body>
</html>